<?php
namespace app\admin\controller;

/**
* 公告
*/
class Notice extends Common
{
	public function index(){
		$noticeRes=db('notice')->order('id desc')->select();
		$this->assign('noticeRes',$noticeRes);
		return view();
	}
	public function add(){
		if (request()->isPost()) {
			$data=input('post.');
			$data['time']=date('Y-m-d H:i:s');
			$add=db('notice')->insert($data);
			if ($add!==false) {
				$this->success('添加成功','index');
			}else{
				$this->error('添加错误');
			}
		}
		return view();
	}
}